
var tableData = {
		url:ctp+"/roleController/roleSearch.shtml", 
		propertys : ["ROLE_NAME","ROLE_DEC","ROLE_SIGN_NAME","STATE_NAME",
		             "REC_PERSON","REC_TIME"],
	    hrefs:[["function=roleUpdate","recId=REC_ID","修改",null]],
	    hidden:["STATE=STATE"], 
		startLoad:function (){ 
		getListData(this);	 
	}

};
function searchData(curr){
	setTagAndValue("form1","curr",curr); 
	tableData.startLoad();
}
$(document).ready(function(){
	searchData();
});

function roleAdd(){
	dialogWin(500,500,ctp+"/roleController/roleAddShow.shtml","角色新增");
}
function roleUpdate(recId){
	dialogWin(550,450,ctp+"/roleController/roleUpdateShow.shtml?recId="+recId,"角色修改");
}
function roleDel(){
	var recIds=getCheckIds();	
	var recStatus=getCheckIds(null,"STATE");	
	if(recStatus.indexOf("0")>=0){
		jalert("包含启用的角色无法删除！");
		return false;
	}
	if(recIds==''){
		jalert("请选择记录！");
		return false;
	}
	jconfirm("del('"+recIds+"')","该操作将会收回已授权用户对应的角色，是否要删除所选角色？");	
}
function del(recIds){
	 $.ajax({ 
		 	url: ctp + "/roleController/roleDelete.shtml",
		    data: {recIds:recIds},
			type : 'POST',
			async:false, 
			success : function(result) {  
				if(result=="") {  
					jalert9("删除成功！"); 		
					  var curr = "1";
					  if($("#form1").find("#curr").length>0){
						  curr = $("#curr").val();
					  }
					  searchData(curr);
				} 		  
				else{     
					jalert(result);   
				} 
	  		}
		});
}




function roleEnbles(recIds){
	$.ajax({
		url:ctp+"/roleController/roleEnable.shtml",
	    data:{recIds:recIds},
	    type:"POST",
	    async:false,
	    success:function(result){
	    	if(result==""){
	    		jalert9("所选择的记录启用成功！");
	    		var curr="1";
	    		if($("#form1").find("#curr").length>0){
	    			curr=$("#curr").val();
	    		}
	    		searchData(curr);
	    	}else{
	    		jalert(result);
	    	}
	    }
     });

}
//角色停用
function roleDisable(){
	var recIds=getCheckIds();
	if (recIds=='') {
		jalert("请选择记录！");
		return false;
	}
	jconfirm("roleDisables('"+recIds+"')", "是否要停用所选记录？");
}
function roleDisables(recIds){
	$.ajax({
		url:ctp+"/roleController/roleDisable.shtml",
		data:{recIds:recIds},
		type:"POST",
		async:false,
		success : function(result) {  
			if(result=="") {  
				jalert9("所选择的记录停用成功！"); 		
				  var curr = "1";
				  if($("#form1").find("#curr").length>0){
					  curr = $("#curr").val();
				  }
				  searchData(curr);
			} 		  
			else{     
				jalert(result);   
			} 
  		}	
	});
}
function roleEnable(){
	var recIds=getCheckIds();
	if(recIds==''){
		jalert("请选择记录");
		return false;
	}
	jconfirm("roleEnbles('"+recIds+"')","是否要启用所选的记录？");
}






